﻿using System;
using System.Collections.Generic;
using System.IO;

namespace OCRDemo
{
    class Program
    {
        static void Main(string[] args)
        {
            var client = new Baidu.Aip.Ocr.Ocr("I0AYrhiP1Kzrze9wCRUVRhDS", "3w7cdqzHfPjim12cCHb7GzvHHHapY3CX");
            var image = File.ReadAllBytes("./1.jpg");
            Console.WriteLine(image);
            Console.WriteLine($"{}");
               
            var idCardSide = "front";// "back";

            // 调用身份证识别，可能会抛出网络等异常，请使用try/catch捕获
            try
            {
                //var result = client.Idcard(image, idCardSide);
                //Console.WriteLine(result);
                // 如果有可选参数
                var options = new Dictionary<string, object>{
                    {"detect_direction", "false"},
                    {"detect_risk", "false"}
                };
                // 带参数调用身份证识别
                var result = client.Idcard(image, idCardSide, options);
                Console.WriteLine(result);
            }
            catch (Exception ex)
            {

                throw;
            }
            
            Console.WriteLine("Hello World!");
            Console.ReadKey();
        }
    }
}
